//
//  AddGoodsPriceCell.m
//  Shengzhuli
//
//  Created by 卡忙科技 on 16/9/7.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "AddGoodsPriceCell.h"

@interface AddGoodsPriceCell()

@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UITextField *nameField;

@end
@implementation AddGoodsPriceCell

- (void)awakeFromNib {
    [super awakeFromNib];
}
- (void)setModel:(AddGoodsModel *)model
{
    _model = model;
    switch (self.tags) {
        case 0:
        {
            self.nameField.text = model.productType;
        }
            break;
        case 1:
        {
            self.nameField.text = model.name;
        }
            break;
        case 2:
        {
            self.nameField.text = model.subtitle;
        }
            break;
        case 3:
        {
            if (model.price >= 0) {
                self.nameField.text = [NSString stringWithFormat:@"%.2f",model.price];
            }
        }
            break;
        case 4:
        {
            if (model.freightInMaxCount >= 0) {
                self.nameField.text = [NSString stringWithFormat:@"%.2f",model.freightInMaxCount];
            }
        }
            break;
        case 5:
        {
            if (model.freightInEveryAdd >= 0) {
                self.nameField.text = [NSString stringWithFormat:@"%.2f",model.freightInEveryAdd];
            }
        }
            break;
        default:
            break;
    }
}
- (void)setFieldDelegate:(id)fieldDelegate
{
    _fieldDelegate = fieldDelegate;
    self.nameField.delegate = fieldDelegate;
}
- (void)setTags:(NSInteger)tags
{
    _tags = tags;
    self.nameField.tag = tags;
    if (tags == 0) {
        self.nameField.userInteractionEnabled = NO;
    }
}
- (void)setNameStr:(NSString *)nameStr
{
    _nameStr = nameStr;
    self.nameLab.text = nameStr;
}
- (void)setPlaceHolder:(NSString *)placeHolder
{
    _placeHolder = placeHolder;
    self.nameField.placeholder = placeHolder;
}

@end
